//*********************************************************
//
//    Copyright (c) Microsoft. All rights reserved.
//    This code is licensed under the Apache License, Version 2.0.
//    THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
//    ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
//    IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
//    PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//********************************************************* 

using System;
using System.Collections.Generic;
using System.IO;

namespace Microsoft.TridentWordAddIn.Common
{
    /// <summary>
    /// Manages storage of files and models
    /// </summary>
    public interface IDataStore
    {
        /// <summary>
        /// Serializes the model.
        /// </summary>
        /// <param name="documentKey">The document key.</param>
        /// <param name="model">The model.</param>
        void SerializeModel(int documentKey, Model model);

        /// <summary>
        /// Deserializes the model.
        /// </summary>
        /// <param name="documentKey">The document key.</param>
        /// <returns>Model</returns>
        Model DeserializeModel(int documentKey);

        /// <summary>
        /// Stores the file.
        /// </summary>
        /// <param name="documentKey">The document key.</param>
        /// <param name="guid">The GUID.</param>
        /// <param name="packageZip">The package zip.</param>
        /// <returns>DocumentFile</returns>
        DocumentFile StoreData(int documentKey, string guid, Stream packageZip);

        /// <summary>
        /// Gets the file from document.
        /// </summary>
        /// <param name="documentKey">The document key.</param>
        /// <param name="outputfilePath">The outputfile path.</param>
        /// <param name="documentFileId">The document file id.</param>
        void CreateFileFromDocumentContent(int documentKey, string outputfilePath, Guid documentFileId);

        /// <summary>
        /// Clears the specified document key.
        /// </summary>
        /// <param name="documentKey">The document key.</param>
        void Clear(int documentKey);

        /// <summary>
        /// Compresses the specified document key.
        /// </summary>
        /// <param name="documentKey">The document key.</param>
        /// <param name="idList">The id list.</param>
        void Compress(int documentKey, List<string> idList);

        /// <summary>
        /// Gets the file data.
        /// </summary>
        /// <param name="documentKey">The document key.</param>
        /// <param name="fileId">The file id.</param>
        /// <returns></returns>
        byte[] GetFileData(int documentKey, Guid fileId);
    }
}